{extend name="public/base" /}
{block name="head"}
    <meta charset="UTF-8">
    <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />

    <link href="__resource_path__/ui-framework/easyui-1.5.2/themes/metro/easyui-c5a176a3d4.css" rel="stylesheet" />
    <link href="__resource_path__/ui-framework/easyui-1.5.2/themes/icon-77a4ded0c8.css" rel="stylesheet" />

    <link href="__resource_path__/ui-framework/bootstrap/3.0.3/css/bootstrap-a067b6d831.min.css" rel="stylesheet" />
    <link href="__resource_path__/ui-framework/bootstrap-daterangepicker/css/daterangepicker-886dba62c4.css" rel="stylesheet" />
    <link href="__resource_path__/ui-framework/font-awesome/css/font-awesome-a81d284b37.css" rel="stylesheet" />

    <link href="__resource_path__/ui-framework/admin-lte/css/AdminLET-7d58b99a7e.css" rel="stylesheet" />
    <link href="__static_path__/css/base-dc47892812.css" rel="stylesheet" />

    <link href="__resource_path__/ui-framework/jason/searchbox/css/searchbox-398327fb84.css" rel="stylesheet" />
    <link href="__resource_path__/ui-framework/jason/pager/css/pager-f077f5e880.css" rel="stylesheet" />
    <link href="__resource_path__/ui-framework/jason/status/css/status-5f59ab3856.css" rel="stylesheet" />
    <link href="__resource_path__/ui-framework/jason/selector/css/selector-23060c280e.css" rel="stylesheet" />
    <link href="__resource_path__/ui-framework/jason/button/css/button-5ef10c798a.css" rel="stylesheet" />
    <link href="__resource_path__/ui-framework/jason/orderarrow/css/orderarrow-dcf8eba7d1.css" rel="stylesheet" />

    <link href="__static_path__/css/table-0e491bc98f.css" rel="stylesheet" />
    <link href="__static_path__/css/easyui-ext-372f902530.css" rel="stylesheet" />


    <link href="__static_path__/css/ground.css" rel="stylesheet" />
    <link rel="stylesheet" href="__static_path__/src/css/layui.css">
{/block}
{block name="content"}
        <section class="content">


            <div class="container" style="width: 100%">
               <table class="order mt10">
                    <tr>
                       
                            <td>团队名称：<span>{$data.name}</span></td>
                            <td>人数：<span>{$data.number}</span>人</td>
                            <td>状态：<span>
                                 {switch name="data['status']" }
                                    {case value="0"}未开始{/case}
                                    {case value="1"}进行中{/case}
                                    {default /}已结束
                                {/switch}
                            </span></td>

                     

                    </tr>
                    <tbody id="title">
                    <tr class="header" style="color:black;">
                        <td><input type="checkbox" id="check"></td>
                        <td>打手</td>
                        <td>账号信息</td>
                        <td>需求</td>
                        <td>装备信息</td>
                        <td>操作</td>
                    </tr>
                    </tbody>
                    <tbody id="users">
                        {foreach $datalist as $vo}
                        <form class="ajaxform">
                            <tr class="project">
                                <td><input type="checkbox" value="{$vo.id}" name="ids[]" class="ids"></td>
                                <td>
                                <select name="uid" data-id="{$vo.id}">
                                {foreach $beaters as $voo}
                                <option value="{$voo.id}" {if($vo.uid==$voo.id)} selected {/if}>{$voo.name}</option>
                                {/foreach}
                                </select>
                                </td>
                                <td><input  type="text" value="{$vo.account}" style="width: 460px;text-align: center;height: 30px;" ></td>
                                <td><input type="text" value="{$vo.demand}" style="width: 200px;text-align: center;height: 30px;"></td>
                                <td style=""><input type="text" value="{$vo.information}" style="width: 200px;text-align: center;padding-right: 40px;height: 30px;"></td>
                                <td>[<a href="javascript:;" class="bj" onclick="edit({$vo.id},this)">修改</a>]&nbsp;&nbsp;[<a href="javascript:;" class="delect" onclick="del({$vo.id})">删除</a>]</td>
                            </tr>
                        </form>
                        {/foreach}
                        <tr class="newdemo project">
                            <td><input type="button" name="" value="批量删除" id="delete"></td>
                            <td>
                                <select name="uid">
                                {foreach $beaters as $vo}
                                <option value="{$vo.id}">{$vo.name}</option>
                                {/foreach}
                                </select>
                                <!-- <input type="text" placeholder="新打手" name="uid"> -->
                            </td>
                            <td>
                                <input type="text" placeholder="测试账号" name="account">
                            </td>
                            <td>
                                <input type="text" placeholder="需求" name="demand">
                            </td>
                            <td>
                                <input type="text" placeholder="装备信息" name="information">
                            </td>
                            <td>
                                <a href="javascript:;" onclick="add({$data.id})">添加+</a>
                            </td>
                        </tr>
                        <tr class="bcinfo">
                            <td colspan="5">
                                *打手、账号信息、需求和装备信息均可编辑
                            </td>
                        </tr>
                        <!-- <tr class="bc">
                            <td colspan="5"><input type="button" name="保存" value="保存"></td>
                        </tr> -->
                    </tbody>
                        
                    </table>
                  <div id="pager" class="fr page_ctrl" style="margin-top: 6px;">
                    {$datalist->render()}
                  </div>
            </div>


        </section>
        {/block}
{block name="script"}
<script src="__resource_path__/libs/jquery/jquery-1-4ed679c998.11.3.min.js"></script>
<script src="__resource_path__/libs/ajaxfileupload-20caa375ef.js"></script>
<script src="__resource_path__/ui-framework/bootstrap/3.0.3/js/bootstrap-7b3098bda9.min.js"></script>
<script src="__resource_path__/ui-framework/bootstrap-daterangepicker/js/moment-zh_cn-3d8809ccd6.js"></script>
<script src="__resource_path__/ui-framework/bootstrap-daterangepicker/js/daterangepicker-bca1a72d19.js"></script>
<script src="__resource_path__/ui-framework/admin-lte/app-bf15eda982.js"></script>

<script src="__resource_path__/ui-framework/easyui-1.5.2/jquery-623c7c7acd.easyui.min.js"></script>
<script src="__resource_path__/ui-framework/easyui/plugins/jquery-1db0d9c758.checkbox.js"></script>
<script src="__resource_path__/ui-framework/jason/searchbox/searchbox-3fc48f72fe.js"></script>
<script src="__resource_path__/ui-framework/jason/pager/pager-0646a093e8.js"></script>
<script src="__resource_path__/ui-framework/jason/status/sky-2d329149af.tools.status.js"></script>
<script src="__resource_path__/ui-framework/jason/screenshot-paste-0b91b6bd4a.js"></script>
<script src="__resource_path__/ui-framework/jason/selector/selector-a0b18d2070.js"></script>
<script src="__resource_path__/ui-framework/jason/button/button-71f76513c7.js"></script>
<script src="__resource_path__/ui-framework/jason/orderarrow/orderarrow-1bbd8bcec2.js"></script>
<script src="__resource_path__/libs/clipboard-892cfb62e7.min.js"></script>
<script src="__resource_path__/libs/template-2d62718262.js"></script>
<script src="__resource_path__/libs/jquery-d833fe9e58.cookie.js"></script>
<script src="__resource_path__/libs/common-21f077db5b.js"></script>
<script src="__resource_path__/libs/tools-4754a28493.js"></script>
<script src="__resource_path__/libs/basePage-d30d50f2ce.js"></script>
<script src="__static_path__/js/order-627da7e816.js"></script>
<script src="__static_path__/js/layer/layer.js"></script>
<script type="text/javascript">
    $().ready(function () {
        var url = $('#hdnURL').val();

        $('.sidebar .treeview').each(function (index, item) {
            var btn = $(this).children("a").first();
            var menu = $(this).children(".treeview-menu").first();

            $(this).find('a').each(function (index, item) {
                if ($(item).attr('href') == url) {
                    menu.show();
                    btn.children(".fa-angle-left").first().removeClass("fa-angle-left").addClass("fa-angle-down");
                }
            });
        });
    });



function add(group_id){
  var uid = $('select[name=uid]').val();
  var account = $('input[name=account]').val();
  var demand = $('input[name=demand]').val();
  var information = $('input[name=information]').val();
  $.post('/index/group/info',{group_id:group_id,uid:uid,account:account,demand:demand,information:information},function(res){
        layer.msg(res.msg);
        if(res.code == 1){
            window.setTimeout(function(){
                window.parent.location.reload();
            },1000);
        }
    });  
}

function edit(id,e){
   // layer.open({
   //     type:2,
   //     title: '<span style="height: 4rem;background: none" class="lay-title">团基本信息</span>',
   //     area:['600px','500px'],
   //     content:'/index/group/editinfo/id/'+id+'.html'
   // })
   var information = $(e).parent().prev().find('input').val();
   var demand = $(e).parent().prev().prev().find('input').val();
   var account = $(e).parent().prev().prev().prev().find('input').val();
   $.post('/index/group/editinfo',{id:id,information:information,demand:demand,account:account},function(res){
        layer.msg(res.msg);
        if(res.code == 1){
            window.setTimeout(function(){
                window.parent.location.reload();
            },1000);
        }
    }); 

}

function del(id){
   $.post('/index/group/delinfo',{id:id},function(res){
        layer.msg(res.msg);
        if(res.code == 1){
            window.setTimeout(function(){
                window.parent.location.reload();
            },1000);
        }
    });  
}

$('#check').click(function() {
    $(".ids").each(function(e){ 
        if ($(".ids").eq(e).prop("checked")) {
            $('.ids').eq(e).removeProp("checked"); 
        }else{
            $('.ids').eq(e).prop("checked",true); 
        }
    })
})

$('#delete').click(function(){
      var form = $('.ajaxform').serialize();

     $.post('{:url("delete")}',form,function(res){
        layer.msg(res.msg);
        if(res.code == 1){
            window.setTimeout(function(){
                window.parent.location.reload();
            },1000);
        }
     })
})

$('select[name=uid]').change(function(){
    var uid = $(this).val();
    var id = $(this).attr('data-id');
    $.post('/index/group/changeBeater',{uid:uid,id:id},function(res){
        layer.msg(res.msg);
        if(res.code == 1){
        }
    });
})
</script>
{/block}